public class Student {

    private String studentId;    // 学生编号
    private String name;         // 姓名
    private String gender;       // 性别
    private Course selectedCourse; // 所选课程（关联Course类）


    public Student(String studentId, String name, String gender) {
        this.studentId = studentId;
        this.name = name;
        this.gender = gender;
    }


    public void selectCourse(Course course) {
        this.selectedCourse = course;
        System.out.println("学生 " + name + " 选择课程：" + course.getCourseName());
    }


    public void dropCourse() {
        if (selectedCourse != null) {
            System.out.println("学生 " + name + " 退课：" + selectedCourse.getCourseName());
            this.selectedCourse = null;
        } else {
            System.out.println("学生 " + name + " 暂无选课，无法退课");
        }
    }


    public void printSchedule() {
        if (selectedCourse != null) {
            Course course = selectedCourse;
            System.out.println("学生 " + name + " 的课表：");
            System.out.println("编号：" + course.getCourseId() + "，课程名称：" + course.getCourseName() +
                    "，上课地点：" + course.getLocation() + "，时间：" + course.getTime() +
                    "，授课教师：" + course.getTeacherId());
        } else {
            System.out.println("学生 " + name + " 暂无选课");
        }
    }


    public String getStudentId() {
        return studentId;
    }

    public void setStudentId(String studentId) {
        this.studentId = studentId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public Course getSelectedCourse() {
        return selectedCourse;
    }
}
